package com.kvn.dubbo.service;

import com.kvn.dubbo.DemoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Service;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;

/**
 * Created by wangzhiyuan on 2019/1/29
 */
@Api("DefaultDemoService")
@Path("demo")
@Service
public class DefaultDemoService implements DemoService {

    /**
     * 访问：http://localhost:8080/swagger/index.html
     * @param name
     * @return
     */
    @Override
    @ApiOperation(value = "demo服务", notes = "测试 swagger 集成。\n" +
            "相比 SpringBoot 集成 swagger 稍显麻烦，类上必须加上 @Api(\"...\")，参数要在 swagger 中显示出来， 必须加上 @xxParam()")
    @GET
    @Path("/say-hello")
    public String sayHello(@QueryParam("name") String name) {
        return "Hello, " + name + " (from Spring Boot)";
    }
}
